import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/toPromise';
import 'rxjs/Rx';
import { RootObject } from './rootObject';

@Injectable()
export class CusindexService {

  constructor(public http: Http) { }

  private consumeUrl = 'http://www.umission-china.com/unail/custom/info/9997';
  private consume2Url = 'http://www.umission-china.com/unail/custom/info';

  getconsume(id: number): Observable <RootObject> {
    const url = `${this.consume2Url}/${id}`;
    return this.http.get(url).map(
      (res: Response) => {
        const result: RootObject = res.json();
        return result;
      }

    );
  }
}
